package com.example.controller;

import com.example.common.result.Result;
import com.example.entity.dto.CenterConfigDto;
import com.example.entity.dto.CenterConfigSelectDto;
import com.example.entity.dto.CenterWorkLeaderDto;
import com.example.entity.vo.CenterConfigInfoVo;
import com.example.entity.vo.CenterConfigResultVo;
import com.example.service.CallCenterConfigService;
import com.example.service.CallCenterLeaderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/callCenter")
@Api(tags = "故障管理")
public class CallCenterController {

    @Autowired
    private CallCenterConfigService configService;

    @ApiOperation("所有故障信息")
    @PostMapping("/list")
    public Result<CenterConfigResultVo> list(@RequestBody CenterConfigSelectDto dto){
        return Result.ok(configService.list(dto));
    }

    @ApiOperation("故障信息详情")
    @GetMapping("/one")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "要查询的故障信息的id", required=true, dataType = "int")
    })
    public Result<CenterConfigInfoVo> one(@RequestParam Integer id){
        return Result.ok(configService.one(id));
    }

    @ApiOperation("新增故障信息")
    @PostMapping("/add")
    public Result<?> add(@RequestBody CenterConfigDto dto){
        configService.add(dto);
        return Result.ok();
    }

    @ApiOperation("修改故障信息")
    @PostMapping("/update")
    public Result<?> update(@RequestBody CenterConfigDto dto){
        configService.update(dto);
        return Result.ok();
    }
}
